#ifndef EVENTDATA_HPP
#define EVENTDATA_HPP
// #include <boost/cstdint.hpp>
#include <stdint.h>
#include <memory.h>
#include "epicsTime.h"
#include "epicsThread.h"
#include "epicsMutex.h"
#include "epicsEvent.h"
#include "errlog.h"
#include "epicsUnitTest.h"
#include "testMain.h"
#include "epicsRingBytes.h"
#include "epicsRingPointer.h"
#include <cstring>
#include <cstdlib>
#define TIME_LOCAL_C 0x00
typedef struct EventRawdata {
    uint64_t event_data;
    uint64_t event_time_0; //pps
    uint64_t event_time_1; //utc
}EventRawdata;

typedef struct ResultData{
    EventRawdata rawData;
    uint64_t tof;
}ResultData;

#define EVENTCOUNT 1

typedef struct PulseData {
uint64_t head0;
uint64_t head1;
uint32_t eventCount;              //包含从strength到最后一个crc之前的长度。
uint32_t strength; //T0 package 
uint64_t ID;
uint64_t RUN;
//接收到t0信号的时间
uint64_t time_local0;
uint64_t time_local1;

uint64_t time_t0_l;
uint64_t time_t0_h;
EventRawdata *pEventData;
uint32_t crc32;
uint32_t res;
uint64_t end0;
uint64_t end1; 


}PulseData;




class DataGenerator {
public:
	DataGenerator();
	~DataGenerator();
	void getrandomNumber(PulseData &);
	EventRawdata mEventRawdata;
	PulseData mPulseData;
private:
	void compute();
	void EventRawdataInit(PulseData &);
	void PulseDataInit();

};

class PulseDataRecieve
{
public:
    PulseDataRecieve(char *, int);
    ~PulseDataRecieve();
    void print();
	PulseData *getPulseDataPointer();
	uint64_t getEventDataCount();
	uint64_t getPulseDataID();
private:
	PulseData *pPulseData;
	uint64_t eventDataCount;//new added
    
	
    
};
typedef struct TcpSocketDataInfo {
    epicsMutexId mutex;
    epicsEventId consumerEvent;
    epicsRingBytesId	ring;
	epicsRingPointer<PulseDataRecieve> *pointerRing;
}TcpSocketDataInfo;



#endif